     /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

// Additional imports
import java.util.Date;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;


/**
 *
 * @author NGUYEN CONG DAT
 */
@Entity
public class GrouponEntity implements Serializable {
    private static long serialVersionUID = 1L;

    /**
     * @return the serialVersionUID
     */
    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    /**
     * @param aSerialVersionUID the serialVersionUID to set
     */
    public static void setSerialVersionUID(long aSerialVersionUID) {
        serialVersionUID = aSerialVersionUID;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;
    private String description;
    private String highlights;
    private String fineprint;
    private Double originalPrice;
    private Double offeredPrice;
    private Double percentCommissionSetByStakeholder;
    private Double percentCommissionSetByTCube;
    private Integer minimumIssuedQuantity;
    private Integer maximumIssuedQuantity;
    private String imageURL;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateOfSubmission;
    // startDate and endDate indicate the groupon selling period
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date startDate;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date endDate;
    // startValidDate and endValidDate indicate the validity period of the issued groupons
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date startValidDate;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date endValidDate;
    private String status;
    private String remarkFromTCube;
    private String remarkFromStakeholder;
    
    @ManyToOne
    private StakeholderEntity stakeholder;
    @OneToMany(mappedBy = "groupon")
    private List<PurchasedGrouponEntity> purchasedGroupons = new ArrayList<PurchasedGrouponEntity>();
    
    public GrouponEntity() {
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GrouponEntity)) {
            return false;
        }
        GrouponEntity other = (GrouponEntity) object;
        if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.GrouponEntity[ id=" + getId() + " ]";
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the originalPrice
     */
    public Double getOriginalPrice() {
        return originalPrice;
    }

    /**
     * @param originalPrice the originalPrice to set
     */
    public void setOriginalPrice(Double originalPrice) {
        this.originalPrice = originalPrice;
    }

    /**
     * @return the offeredPrice
     */
    public Double getOfferedPrice() {
        return offeredPrice;
    }

    /**
     * @param offeredPrice the offeredPrice to set
     */
    public void setOfferedPrice(Double offeredPrice) {
        this.offeredPrice = offeredPrice;
    }

    /**
     * @return the imageURL
     */
    public String getImageURL() {
        return imageURL;
    }

    /**
     * @param imageURL the imageURL to set
     */
    public void setImageURL(String imageURL) {
        this.imageURL = imageURL;
    }

    /**
     * @return the startDate
     */
    public Date getStartDate() {
        return startDate;
    }

    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    /**
     * @return the endDate
     */
    public Date getEndDate() {
        return endDate;
    }

    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    /**
     * @return the status
     */
    public String getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * @return the stakeholder
     */
    public StakeholderEntity getStakeholder() {
        return stakeholder;
    }

    /**
     * @param stakeholder the stakeholder to set
     */
    public void setStakeholder(StakeholderEntity stakeholder) {
        this.stakeholder = stakeholder;
    }

    /**
     * @return the purchasedGroupons
     */
    public List<PurchasedGrouponEntity> getPurchasedGroupons() {
        return purchasedGroupons;
    }

    /**
     * @param purchasedGroupons the purchasedGroupons to set
     */
    public void setPurchasedGroupons(List<PurchasedGrouponEntity> purchasedGroupons) {
        this.setPurchasedGroupons(purchasedGroupons);
    }

    /**
     * @return the dateOfSubmission
     */
    public Date getDateOfSubmission() {
        return dateOfSubmission;
    }

    /**
     * @param dateOfSubmission the dateOfSubmission to set
     */
    public void setDateOfSubmission(Date dateOfSubmission) {
        this.dateOfSubmission = dateOfSubmission;
    }

    /**
     * @return the remarkFromTCube
     */
    public String getRemarkFromTCube() {
        return remarkFromTCube;
    }

    /**
     * @param remarkFromTCube the remarkFromTCube to set
     */
    public void setRemarkFromTCube(String remarkFromTCube) {
        this.remarkFromTCube = remarkFromTCube;
    }

    /**
     * @return the startValidDate
     */
    public Date getStartValidDate() {
        return startValidDate;
    }

    /**
     * @param startValidDate the startValidDate to set
     */
    public void setStartValidDate(Date startValidDate) {
        this.startValidDate = startValidDate;
    }

    /**
     * @return the endValidDate
     */
    public Date getEndValidDate() {
        return endValidDate;
    }

    /**
     * @param endValidDate the endValidDate to set
     */
    public void setEndValidDate(Date endValidDate) {
        this.endValidDate = endValidDate;
    }

    /**
     * @return the minimumIssuedQuantity
     */
    public Integer getMinimumIssuedQuantity() {
        return minimumIssuedQuantity;
    }

    /**
     * @param minimumIssuedQuantity the minimumIssuedQuantity to set
     */
    public void setMinimumIssuedQuantity(Integer minimumIssuedQuantity) {
        this.minimumIssuedQuantity = minimumIssuedQuantity;
    }

    /**
     * @return the maximumIssuedQuantity
     */
    public Integer getMaximumIssuedQuantity() {
        return maximumIssuedQuantity;
    }

    /**
     * @param maximumIssuedQuantity the maximumIssuedQuantity to set
     */
    public void setMaximumIssuedQuantity(Integer maximumIssuedQuantity) {
        this.maximumIssuedQuantity = maximumIssuedQuantity;
    }

    /**
     * @return the highlights
     */
    public String getHighlights() {
        return highlights;
    }

    /**
     * @param highlights the highlights to set
     */
    public void setHighlights(String highlights) {
        this.highlights = highlights;
    }

    /**
     * @return the fineprint
     */
    public String getFineprint() {
        return fineprint;
    }

    /**
     * @param fineprint the fineprint to set
     */
    public void setFineprint(String fineprint) {
        this.fineprint = fineprint;
    }

    public String getRemarkFromStakeholder() {
        return remarkFromStakeholder;
    }

    public void setRemarkFromStakeholder(String remarkFromStakeholder) {
        this.remarkFromStakeholder = remarkFromStakeholder;
    }

    public Double getPercentCommissionSetByStakeholder() {
        return percentCommissionSetByStakeholder;
    }

    public void setPercentCommissionSetByStakeholder(Double percentCommissionSetByStakeholder) {
        this.percentCommissionSetByStakeholder = percentCommissionSetByStakeholder;
    }

    public Double getPercentCommissionSetByTCube() {
        return percentCommissionSetByTCube;
    }

    public void setPercentCommissionSetByTCube(Double percentCommissionSetByTCube) {
        this.percentCommissionSetByTCube = percentCommissionSetByTCube;
    }    
}
